/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package generic.demo;

import java.util.*;

/**
 *
 * @author VANDH ; -> type paremeter
 */
public class CarList<T> { // - generic class, T -> type parameter

    HashMap<String, T> list;

    public CarList() {
        this.list = new HashMap<String, T>();
    }

    public void addCar(String key, T c) {
        list.put(key, c); // key -> value
    }

    public T getCar(String key) {
        return list.get(key);
    }

    public <E extends String> void display(LinkedList<E> l) { // - generic method
        // upper bound
        // ? wildcard
        // Collections

        for (E i : l) {
            System.out.println(i);
        }

//        int[] arrayInt = new int[]{1, 2, 3, 4, 5};
//        for (int i = 0; i < 3; i++) {
//            System.out.println(i);
//        }
//
//        for (int i : arrayInt) {
//            System.out.println(i);
//        }
    }
}
